package com.hqd.ch03.v48.boot.context.config;

import java.util.Collections;
import java.util.List;

/**
 * 配置文件资源定位
 *
 * @param <R>
 */
public interface ConfigDataLocationResolver<R extends ConfigDataResource> {

    /**
     * 支持的协议
     *
     * @param context
     * @param location
     * @return
     */
    boolean isResolvable(ConfigDataLocationResolverContext context, ConfigDataLocation location);

    /**
     * 解析成对应配置信息
     *
     * @param context
     * @param location
     * @return
     * @throws ConfigDataLocationNotFoundException
     * @throws ConfigDataResourceNotFoundException
     */
    List<R> resolve(ConfigDataLocationResolverContext context, ConfigDataLocation location)
            throws ConfigDataLocationNotFoundException, ConfigDataResourceNotFoundException;

    default List<R> resolveProfileSpecific(ConfigDataLocationResolverContext context, ConfigDataLocation location,
                                           Profiles profiles) throws ConfigDataLocationNotFoundException {
        return Collections.emptyList();
    }
}

